{extend name="common/index"}
{block name="content"}
<div class="layui-row">
    <form id="editForm" class="layui-form tpl-form-label-long" action="" >
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title">
                {notempty name="list"}
                    {volist name="list" id="vo"}
                        <li {eq name="key" value="0" }class="layui-this"{/eq}>{$vo.view_name}</li>
                    {/volist}
                {/notempty}
            </ul>
            <div class="layui-tab-content">
                {notempty name="list"}
                    {volist name="list" id="vo"}
                        <div class='layui-tab-item {eq name="key" value="0" }layui-show{/eq}'>
                            {$vo.child_html}
                        </div>
                    {/volist}
                {/notempty}
            </div>
        </div>
        <div class="tpl-form-action">
            <button class="layui-btn layui-btn-radius layui-btn-lg" lay-submit lay-filter="formSubmit">保存</button>
        </div>
    </form>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    layui.use(['form'], function () {
        var form = layui.form;

        uploadImgAjax('.img_browser_logo', '{:url("uploadImg")}', 100);//上传浏览器标签Logo
        uploadImgAjax('.img_web_logo', '{:url("uploadImg")}', 1024);//上传网站Logo

        //监听提交
        form.on('submit(formSubmit)', function(data){
            var index = layer.load(2, {shade:[0.5,'#000'],time: 10*1000});
            $.post('{:url("save")}', $('#editForm').serialize(), function (result) {
                layer.close(index);
                if (result.code) {
                    layer.msg(result.msg, {shade:[0.5,'#000'],time:1000}, function () {
                        window.location.reload();
                    });
                } else {
                    layer.alert(result.msg, {icon:2, title:'保存失败！'});
                }
            }, 'json');
            return false;
        });
    });
</script>

{/block}